import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import './assets/css/global.css'
import 'element-plus/lib/theme-chalk/index.css' // 引入element-plus全局css
import installElementPlus from './plugins/element'
import axios from 'axios'

axios.defaults.baseURL = 'https://lianghj.top:8888/api/private/v1/'
axios.interceptors.request.use(config => {
  // 请求拦截器,为请求挂载Authorization: token的请求头
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})

const app = createApp(App)
installElementPlus(app)
app.config.globalProperties.$axios = axios
app
  .use(router)
  .mount('#app')
